package com.cskaoyan;

import com.cskaoyan.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class AddJDBCDemo2 {

    public static void main(String[] args) throws SQLException {

        Connection connection = JDBCUtils.getConnection();


        // 获取一个Statement对象 , statement对象是用来执行SQL语句的
        Statement statement = connection.createStatement();


        // 执行SQL语句, 返回影响的行数
        String sql = "insert into city values (8,'蚌埠市',80),(9,'苏州市',78)";
        int affectedRows = statement.executeUpdate(sql);



        // 展示执行的结果
        System.out.println("affectedRows:" + affectedRows);

       JDBCUtils.closeSource(connection,statement,null);
    }
}
